package com.oa.office.dao;

import org.apache.ibatis.jdbc.SQL;

import com.oa.office.entity.Shar;

public class SharSqlProvider {

    public String insertSelective(Shar record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("shar");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getSharType() != null) {
            sql.VALUES("shar_type", "#{sharType,jdbcType=VARCHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.VALUES("creater", "#{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdater() != null) {
            sql.VALUES("updater", "#{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getSpar() != null) {
            sql.VALUES("spar", "#{spar,jdbcType=VARCHAR}");
        }
        
        if (record.getHead() != null) {
            sql.VALUES("head", "#{head,jdbcType=VARCHAR}");
        }
        
        if (record.getState() != null) {
            sql.VALUES("state", "#{state,jdbcType=INTEGER}");
        }
        
        if (record.getSharContent() != null) {
            sql.VALUES("shar_content", "#{sharContent,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(Shar record) {
        SQL sql = new SQL();
        sql.UPDATE("shar");
        
        if (record.getSharType() != null) {
            sql.SET("shar_type = #{sharType,jdbcType=VARCHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.SET("creater = #{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdater() != null) {
            sql.SET("updater = #{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getSpar() != null) {
            sql.SET("spar = #{spar,jdbcType=VARCHAR}");
        }
        
        if (record.getHead() != null) {
            sql.SET("head = #{head,jdbcType=VARCHAR}");
        }
        
        if (record.getState() != null) {
            sql.SET("state = #{state,jdbcType=INTEGER}");
        }
        
        if (record.getSharContent() != null) {
            sql.SET("shar_content = #{sharContent,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}